//引入菜单的接口方法
import { Message } from "element-ui";
import { secklist } from "../../request/api";

export default {
    state: {
        seckillList: [],//这是seckill的初始数组
        is: {//判断是否显示dialog 弹窗
            show: false
        }
    },
    getters: {},
    mutations: {
        //修改seckill数据 初始数据
        GETSECKILLLIST(state, payload) {
            state.seckillList = payload;
        },
        //修改dialog弹窗
        changeDialog(state, payload) {
            state.is.show = payload;
        }
    },
    actions: {
        //异步操作 获取数据 seckill
        getSECKILLList({ commit }) {
            secklist().then(res => {
                //判断是否正确获取数据
                if (res.code == 200) {
                    commit("GETSECKILLLIST", res.list);
                    // console.log(res.list,'menumenu');
                } else {
                    Message.error(res.msg);
                }
            })
        }
    },
    namespaced: true
}